import numpy as np

# sum
a1=np.array([[1,2],
             [3,4]])
print(np.sum(a1))
print(np.sum(a1,axis=1))
print(a1.sum(axis=1))
a2=np.array([[1,2],
             [3,np.nan]])
print(np.sum(a2))
print(np.sum(a2,axis=1))
print(a2.sum(axis=1))
print(np.nansum(a2))
# max
print(np.amax(a1))
print(np.amax(a1,axis=1))
print(a1.max(axis=1))
print(np.nanmax(a2))
# min
print(np.amin(a1))
print(np.amin(a1,axis=1))
print(a1.min(axis=1))
print(np.nanmin(a2))
# mean
print(np.mean(a1))
print(np.mean(a1,axis=1))
print(a1.mean(axis=1))
print(np.nanmean(a2))
# average
print(np.average(a1,weights=[[0.7,0.1],[0.1,0.1]]))
